$$.data = {};
/**
 * @class $$.data.SQL
 * @extends Object
 * Reader与Writer共为父类SQL
 */
$$.data.SQL = function(){
	
}
;(function(){
    // SQL转义函数
	var  replaceSingleQutoe_Fn = $$.String.replace
		,replaceSingleQutoe_Fn = replaceSingleQutoe_Fn.delegateArgs(/'/g, "''");

	var 
		 replaceInject_Fn = String().replace
		,replaceInject_Fn = replaceInject_Fn.reduce
		.replaceInject_Fn = replaceInject_Fn.delegateScope(replaceInject_Fn)
		,replaceInject_Fn = replaceInject_Fn.delegate(null, [
			 ["select", "sel&#101;ct"]
			,["execute", "&#101xecute"]
			,["exec", "&#101xec"]
			,["join", "jo&#105;n"]
			,["union", "un&#105;on"]
			,["where", "wh&#101;re"]
			,["insert", "ins&#101;rt"]
			,["delete", "del&#101;te"]
			,["update", "up&#100;ate"]
			,["like", "lik&#101;"]
			,["drop", "dro&#112;"]
			,["create", "cr&#101;ate"]
			,["rename", "ren&#097;me"]
			,["count", "co&#117;nt"]
			,["chr", "c&#104;r"]
			,["mid", "m&#105;d"]
			,["truncate", "trunc&#097;te"]
			,["nchar", "nch&#097;r"]
			,["char", "ch&#097;r"]
			,["alter", "alt&#101;r"]
			,["cast", "ca&#115;t"]
			,["exists", "e&#120;ists"]
		]);
	function removeTags(sql){
		return sql;
	}
	
	$$.data.SQL.prototype = {
		 noQutoe	: replaceSingleQutoe_Fn
		,noInject	: replaceInject_Fn
		,removeTags	: removeTags
		,ESC		: replaceSingleQutoe_Fn.C(replaceInject_Fn).C(removeTags)
	}; 
})();